package com.franklin.plugins.common.thread;

import java.util.concurrent.CountDownLatch;

/**
 * 包装CountDownLatch，让代码简洁一点
 * @author Franklin
 * @since 2021/9/23 17:28
 */
public class MyCountDownLatch {

    private final CountDownLatch countDownLatch;

    public MyCountDownLatch(int count){
        this.countDownLatch = new CountDownLatch(count);
    }

    public void countDown(){
        this.countDownLatch.countDown();
    }

    public void await(){
        try {
            this.countDownLatch.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
